package com.aps.demo.receiver;

import com.aps.demo.model.ProductionData;

/**
 * 数据接收器接口
 * 用于从不同数据源接收生产数据
 */
public interface DataReceiver {
    
    /**
     * 接收数据
     * 
     * @return 生产数据
     */
    ProductionData receive();
    
    /**
     * 验证数据
     * 
     * @param data 生产数据
     * @return 验证结果
     */
    ValidationResult validate(ProductionData data);
    
    /**
     * 验证结果
     */
    class ValidationResult {
        private boolean isValid;
        private String[] errors;
        
        public ValidationResult(boolean isValid, String... errors) {
            this.isValid = isValid;
            this.errors = errors;
        }
        
        public boolean isValid() {
            return isValid;
        }
        
        public String[] getErrors() {
            return errors;
        }
        
        public static ValidationResult success() {
            return new ValidationResult(true);
        }
        
        public static ValidationResult failure(String... errors) {
            return new ValidationResult(false, errors);
        }
    }
} 